<?php
   include_once("database.php");
   $sql = "select book_id,book_name,book_author,book_price,book_publisher,book_content from book_info";
   $query = mysql_query($sql);
   $list = array();
   while($row = mysql_fetch_array($query))
   {
   		$list[] = $row;
   }
   mysql_close($con);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Show books</title>
<script language="javascript" src="jquery.js"></script>
<script language="javascript">
	$(document).ready(function(){
		$(".table_box1 tr:odd").addClass('bluebg');
		$(".table_box1 tr:even").addClass('whitebg');
        
		$("#selelct_all").click(function(){
			$(".del_record").each(function(){
				$(this).attr("checked",true);
			});
		});
		$("#cancle_selelct_all").click(function(){
			$(".del_record").each(function(){
				$(this).attr("checked",false);
			});
		});
	});
	
</script>
<style>
table tbody tr.whitebg{
	background: none repeat scroll 0 0 #FFFFFF;
}
table tbody tr.bluebg{
	background: none repeat scroll 0 0 #F9EDED;
}
</style>
</head>
<body>
<?php?>
<table class="table_box1" width="880" align="center" cellpadding="1" cellspacing="1" bgcolor="#999999"  >
	<Tr>
	  <td width="100" align="center" bgcolor="#FFFFFF">修改 </td>
	  <td width="100" align="center" bgcolor="#FFFFFF">删除</td>
	  <td width="100" align="center" bgcolor="#FFFFFF">书名</td>
	  <td width="100" align="center" bgcolor="#FFFFFF">单价</td>
	  <td width="100" align="center" bgcolor="#FFFFFF">作者</td>
	  <td width="180" align="center" bgcolor="#FFFFFF">出版社</td>
	  <td width="500" align="center" bgcolor="#FFFFFF">简介</td>
  </Tr>
  	<?php
		foreach($list as $key => $val)
		{
	?>
	<Tr>
	    <td width="100" align="center" bgcolor="#FFFFFF"><a href="update.php?id=<?php echo $val['book_id'];?>"><img src="edit.gif"  border="0"/></a></td>
	    <td width="100" align="center" bgcolor="#FFFFFF"><a href="update.php?id=<?php echo $val['book_id'];?>">
	      <input name="checkbox[<?php echo $val['book_id'];?>]" type="checkbox" class="del_record" value="1"/>
	    </a></td>
		<td width="100" align="center" bgcolor="#FFFFFF"><a href="update.php?id=<?php echo $val['book_id'];?>"><?php echo $val['book_name'];?></a></td>
		<td width="100" align="center" bgcolor="#FFFFFF"><a href="update.php?id=<?php echo $val['book_id'];?>"><?php echo $val['book_author'];?></a></td>
		<td width="100" align="center" bgcolor="#FFFFFF"><a href="update.php?id=<?php echo $val['book_id'];?>"><?php echo $val['book_price'];?></a></td>
		<td width="180" align="center" bgcolor="#FFFFFF"><a href="update.php?id=<?php echo $val['book_id'];?>"><?php echo $val['book_publisher'];?></a></td>
		<td width="500" align="center" bgcolor="#FFFFFF"><a href="update.php?id=<?php echo $val['book_id'];?>"><?php echo $val['book_content'];?></a></td>
    </Tr>
<?php
		}
	?>
	<tr>
	    <td colspan="7" align="center" bgcolor="#FFFFFF">
	      <input type="submit" name="Submit" value="全 选" id="selelct_all"/>
	      <input type="submit" name="Submit" value="全不选" id="cancle_selelct_all"/>
		  <input type="submit" name="Submit" value="删 除" id="del"/>
        <a href="update.php?id=<?php echo $val['book_id'];?>"></a></td>
    </tr>
	<tr>
	  <td colspan="7" align="center" bgcolor="#FFFFFF">&nbsp;</td>
  </tr>
</table>
</body>
</html>